/*
 * ClientCommands.hpp
 *
 *  Created on: 14 mei 2013
 *      Author: maarten
 */

#ifndef CLIENTCOMMANDS_HPP_
#define CLIENTCOMMANDS_HPP_

#define ERROR_OPEN_FILE -10
#define ERROR_WRITE_FILE -11
#define ERROR_CLOSE_FILE -12

#include "Parser.hpp"
#include "Message.hpp"
#include <string>
#include <vector>

class ClientCommands {
public:
	ClientCommands();
	void setSocketDescriptor(int socketDescriptor);
	bool getHANIntern();
	virtual ~ClientCommands();

	int requestLogon(std::string username, std::string password);
	int requestUpload(std::string filePath, std::string fileTargetPath);
	int requestDownload(std::string filename, std::string path);
	int requestDelete(std::string file);
	int requestRename(std::string oldName, std::string newName);
	int requestAddDir(std::string dirName);
	std::vector<std::string> requestDirStructure(std::string dir);
	std::vector<std::string> getDirs(std::vector<std::string> dirStruct);
	std::vector<std::string> getFiles(std::vector<std::string> dirStruct);

private:
	int socketDescriptor;
	Parser parser;
	bool HANIntern;
	std::vector<std::string> extensions;

	Message waitForResponse();
	int checkMessageCode(int code, int expectedCode);
	int checkMessageCodeMore(int code, std::vector<int> expectedCode);

	int messageCode;

};

#endif /* CLIENTCOMMANDS_HPP_ */
